<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        //合并两个数组
        var a = [1, 2],
            b = [3];
        function merge(arr1, arr2) {
            var a1Len = arr1.length;
            var a2Len = arr2.length;
            var res = [];
            for (var i = 0; i < a1Len; i++) {
                res.push(arr1[i]);
            }
            for (var i = 0; i < a2Len; i++) {
                res.push(arr2[i]);
            }
            return res;
        }
        console.log(merge(a, b));




    </script>
</body>

</html>